function out = thresholdCell_2( y, alpha, HD)
 n = numel(HD);
 nlevels = numel(y);
 [M N] = size(y{1});
  M = M / n;
  N = N / n;
  
  for k = 1 : nlevels
  tmp = zeros( M, N);
  for i = 1 : n
      for j = 1 : n
          tmp = tmp + y{k}((i-1)*M+1:i*M, (j-1)*N+1:j*N).^2;
      end
  end
  Tmp1 = repmat(sqrt(tmp),[n,n]);  
  Tmp2 = alpha*ones(size(Tmp1));
  Tmp = max(Tmp1, Tmp2);
  out{k} = Tmp1./Tmp;
  end
end